<?php
if (!defined('APP_ID')) { die('No direct script access allowed'); }

class Database_Query_Mysql_Delete extends Database_Query_Mysql {
	private $_table = '';
	private $_where = array();

	public function table($table) {
		$this->_table = $table;
		return $this;
	}

	public function where() {
		$args = func_get_args();
		$this->_where[] = $args;
		return $this;
	}

	public function compile() {
		$sql = "DELETE FROM `" . $this->_table . "`";

		$where = $this->parse($this->_where);
		if (!empty($where)) {
			$sql .= " WHERE (" . $where . ")";
		}

		return $sql;
	}
}
